import random

money = 5000
ipt = int(input())
rdm = random.randint(1, 20)
while ipt != rdm and money >= 500:
    if ipt > rdm:
        print("大了")
    if ipt < rdm :
        print("小了")
    money -= 500
    ipt = int(input())
if ipt == rdm:
    money += 3000
    print(f"恭喜猜中，本轮幸运数字：{rdm},本金余额为{money}")
print(f"余额不足，本金余额为{money}")

